<section class="search">
  <form action="<%= Routes.search_path(@conn, :search) %>" method="get" class="search-form">
    <label class="visually_hidden" for="name">Search</label>
    <input name="q" type="text" placeholder="Search Changelog..." value="<%= @query %>" autofocus />

    <div class="search-form-footer">
      <a href="https://typesense.org/?utm_source=changelog&utm_campaign=changelog-search&utm_medium=referral" class="search-form-footer-typesense">
        Search by <img src="<%= url(~p"/images/icons/typesense.svg") %>" alt="Typesense" width="89" height="20">
      </a>

      <%= if @page.total_entries > 0 do %>
        <p class="search-form-footer-results">We found <%= SharedHelpers.pluralize(@page.total_entries, "result", "results") %>.</p>
      <% else %>
        <%= if String.length(@query) != 0 do %>
          <p class="search-form-footer-results">
            Sorry, we didn't find anything. 😔
          </p>
        <% end %>
      <% end %>
    </div>
  </form>

  <%= if Enum.any?(@items) do %>
    <%= if @page.total_entries > 0 do %>
      <a id="feed" class="anchor"></a>
      <div class="feed">
        <%= for {item, highlight}  <- @items do %>
          <%= render(NewsItemView, "_summary.html", Map.merge(assigns, %{item: item, style: "date", highlight: highlight})) %>
        <% end %>
        <%= render(SharedView, "_more_button.html", assigns) %>
      </div>
    <% end %>
  <% end %>
</section>
